/**
 * 
 */
package com.jeecms.wicool.manager.shops.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeecms.cms.entity.main.CmsUser;
import com.jeecms.common.hibernate3.Updater;
import com.jeecms.common.page.Pagination;
import com.jeecms.wicool.dao.shops.AdviserDao;
import com.jeecms.wicool.entity.shops.Adviser;
import com.jeecms.wicool.manager.shops.AdviserMng;

/**
 * @author spring
 *
 */
@Service
@Transactional
public class AdviserMngImpl implements AdviserMng {
	
	@Autowired
	private AdviserDao adviserDao;

	@Override
	public Pagination getPage(String name, String loginName, int pageNo,
			int pageSize, CmsUser user) {
		return adviserDao.getPage(name, loginName, pageNo, pageSize, user);
	}

	@Override
	public Adviser findById(Integer id) {
		return adviserDao.findById(id);
	}

	@Override
	public Adviser save(Adviser bean) {
		return adviserDao.save(bean);
	}

	@Override
	public Adviser update(Adviser bean) {
		Updater<Adviser> updater = new Updater<Adviser>(bean);
		return adviserDao.updateByUpdater(updater);
	}

	public Adviser deleteById(Integer id){
		return adviserDao.deleteById(id);
	}
	
	@Override
	public Adviser[] deleteByIds(Integer[] ids) {
		Adviser[] beans = new Adviser[ids.length];
		for (int i = 0,len = ids.length; i < len; i++) {
			beans[i] = deleteById(ids[i]);
		}
		return beans;
	}

}
